package paginas;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowFocusListener;
import java.util.ResourceBundle;
import java.util.Vector;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import util.TransicionBotones;
import AccionBoton.AccionFocoVentana;

public class BibliotecaMultimedia extends JDialog {
	
	private static final long serialVersionUID = 1L;
	private JFrame frame;
	private JTabbedPane panel;
	private JPanel tab1;
	private JPanel tab2;
	private JPanel tab3;
	private TransicionBotones policy;
	private Vector<Component> order;
	private WindowFocusListener foco;
	private Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	
	public BibliotecaMultimedia(JFrame padre){
		
		frame = padre;
		initComponents();
        order = new Vector<Component>(6);
        order.add(tab1);
        order.add(tab2);
        order.add(tab3);

        foco = new AccionFocoVentana(tab1);

        addWindowFocusListener(foco);
        setFocusable(true);
        policy = new TransicionBotones(order);
        setFocusTraversalPolicy(policy);
        setBounds(0, 0, (int) Math.floor(screenSize.getWidth()*0.7), (int) Math.floor(screenSize.getHeight()*0.7));
		setPreferredSize(new Dimension((int) Math.floor(screenSize.getWidth()*0.7), (int) Math.floor(screenSize.getHeight()*0.7)));
		setLocationRelativeTo(null);
		setVisible(true);
		pack();
		repaint();
	}
	
	
private void initComponents(){
		
		panel = new JTabbedPane();
	
		tab1 = new BibliotecaImagenes(this, frame);
		tab2 = new BibliotecaImagenes(this, frame);
		tab3 = new BibliotecaImagenes(this, frame);
		//tab2 = new BibliotecaSonidos();
		//tab3 = new BibliotecaCreditos();

		
		panel.addTab(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_biblioteca_imagenes"), tab1);
		panel.addTab(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_biblioteca_sonidos"), tab2);
		panel.addTab(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_biblioteca_creditos"), tab3);
		add(panel);
	}
}
